package com.message.tcp.ip.socket.configure.service;

import java.sql.SQLException;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.message.tcp.ip.socket.configure.dao.DataElementDao;
import com.message.tcp.ip.socket.configure.entity.DataElement;
@Service("dataElementService")
public class DataElementServiceImp implements DataElementService {
	private static final Logger logger = Logger.getLogger(DataElementServiceImp.class);
	@Autowired
	private DataElementDao dataElementDao;
	public void setDataElementDao(DataElementDao dataElementDao){
		this.dataElementDao = dataElementDao;
	}
	@Override
	public void update(DataElement de) {
		try {
			dataElementDao.update(de);
		} catch (SQLException e) {
			logger.debug("Exception occur while try to update data element", e);
		}
	}

	@Override
	public void save(DataElement de) {
		try {
			dataElementDao.save(de);
		} catch (SQLException e) {
			logger.debug("Exception occur while try to save data element", e);
		}
	}

	@Override
	public String getDataValue(String de) {
		try {
			return dataElementDao.getDataValue(de);
		} catch (SQLException e) {
			logger.debug("Exception occur while try to get data value", e);
			return null;
		}
	}

}
